#pragma once

#ifdef DHVIDEO_EXPORT
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT __declspec(dllimport)
#endif

//#define TEST

extern "C"
{
	//编码解码使用单线程处理,数据需要调用前缓存
	//0-自动识别默认设置,1-none,2-qsv,3-cuda
	DLL_EXPORT void SetHWAccels(int type);
	//RGB24:2,BGR24:3,GRAY8:8,MONO:9,ARGB:25,RGBA:26
	DLL_EXPORT void SetBitmapFormat(int format);
	//日志等级
	DLL_EXPORT void SetLogDisplay(bool bshow);
	//文件时长
	DLL_EXPORT __int64 GetFileTimeSpan(const char* file);

	//code:h265(173),h264(27),mpeg2video(2)
    //编码
	DLL_EXPORT void BeginEncode(void** handle, void* obj, int width, int height, int framerate, __int64 bitrate, int code, void(*encode)(void* obj, unsigned char* data, int& len));
	DLL_EXPORT void ImageEncode(void** handle, unsigned char* image_data, int image_lens);
	DLL_EXPORT void EndEncode(void** handle);
    //解码
	DLL_EXPORT void BeginDecode(void** handle, void* obj, int code, void(*decode)(void* obj, unsigned char* data, int& len, int frame_index));
	DLL_EXPORT void ImageDecode(void** handle, unsigned char* data, int lens);
	DLL_EXPORT void EndDecode(void** handle);
	//复用
	DLL_EXPORT void BeginMuxing(void** handle, const char* fileName,int width,int height,int framerate,int bitrate, int code, bool encode);
	DLL_EXPORT void Muxing(void** handle, unsigned char* data, int lens);
	DLL_EXPORT void EndMuxing(void** handle);
	//转码
	DLL_EXPORT void BeginTranscode(void** handle, void* obj, int width, int height, int framerate, int code, int destcode, void(*transcode)(void* obj, unsigned char* data, int& len));
	DLL_EXPORT void Transcode(void** handle, unsigned char* data, int lens);
	DLL_EXPORT void EndTranscode(void** handle);
    //文件分割
	DLL_EXPORT void BeginSplitFile(void** handle, const char* file,const char* out_file);
	DLL_EXPORT void SplitFile(void** handle, double from, double to);
	DLL_EXPORT void EndSplitFile(void** handle);
	
	// //qsv原生编码
	// DLL_EXPORT void MfxBeginEncode(void** handle, void* obj, int width, int height, int framerate, __int64 bitrate, int code, void(*encode)(void* obj, unsigned char* data, int& len));
	// DLL_EXPORT void MfxImageEncode(void** handle, unsigned char* image_data, int image_lens);
	// DLL_EXPORT void MfxEndEncode(void** handle);
    // //qsv原生解码
	// DLL_EXPORT void MfxBeginDecode(void** handle, void* obj, int code, void(*decode)(void* obj, unsigned char* data, int& len, int frame_index));
	// DLL_EXPORT void MfxImageDecode(void** handle, unsigned char* data, int lens);
	// DLL_EXPORT void MfxEndDecode(void** handle);
}